package com.parachutes.aspinterfaceapi.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 接口调用记录表
 * @TableName bus_interface_invoke_record
 */
@TableName(value ="bus_interface_invoke_record")
@Data
public class BusInterfaceInvokeRecord implements Serializable {
    /**
     * 记录ID，主键，自增
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 接口ID，外键，关联到bus_interface表的id字段
     */
    private Integer interfaceId;

    /**
     * 请求ID，不能为空
     */
    private String requestId;

    /**
     * 用户代理信息，默认为NULL
     */
    private String userAgent;

    /**
     * 客户端IP地址，默认为NULL
     */
    private String clientIp;

    /**
     * 请求时间，默认为当前时间
     */
    private Date requestTime;

    /**
     * 响应时间，默认为NULL
     */
    private Date responseTime;

    /**
     * 请求大小，默认值为0
     */
    private Integer requestSize;

    /**
     * 响应大小，默认值为0
     */
    private Integer responseSize;

    /**
     * 记录创建时间，默认为当前时间
     */
    private Date createdAt;

    /**
     * 创建人ID，不能为空
     */
    private Integer createdBy;

    /**
     * 记录更新时间，自动更新时间戳
     */
    private Date updatedAt;

    /**
     * 更新人ID，不能为空
     */
    private Integer updatedBy;

    /**
     * 逻辑删除字段（0 = 未删除，1 = 已删除）
     */
    private Integer isDeleted;

    /**
     * 用户 ID
     */
    private Long userId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        BusInterfaceInvokeRecord other = (BusInterfaceInvokeRecord) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getInterfaceId() == null ? other.getInterfaceId() == null : this.getInterfaceId().equals(other.getInterfaceId()))
            && (this.getRequestId() == null ? other.getRequestId() == null : this.getRequestId().equals(other.getRequestId()))
            && (this.getUserAgent() == null ? other.getUserAgent() == null : this.getUserAgent().equals(other.getUserAgent()))
            && (this.getClientIp() == null ? other.getClientIp() == null : this.getClientIp().equals(other.getClientIp()))
            && (this.getRequestTime() == null ? other.getRequestTime() == null : this.getRequestTime().equals(other.getRequestTime()))
            && (this.getResponseTime() == null ? other.getResponseTime() == null : this.getResponseTime().equals(other.getResponseTime()))
            && (this.getRequestSize() == null ? other.getRequestSize() == null : this.getRequestSize().equals(other.getRequestSize()))
            && (this.getResponseSize() == null ? other.getResponseSize() == null : this.getResponseSize().equals(other.getResponseSize()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getCreatedBy() == null ? other.getCreatedBy() == null : this.getCreatedBy().equals(other.getCreatedBy()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()))
            && (this.getUpdatedBy() == null ? other.getUpdatedBy() == null : this.getUpdatedBy().equals(other.getUpdatedBy()))
            && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getInterfaceId() == null) ? 0 : getInterfaceId().hashCode());
        result = prime * result + ((getRequestId() == null) ? 0 : getRequestId().hashCode());
        result = prime * result + ((getUserAgent() == null) ? 0 : getUserAgent().hashCode());
        result = prime * result + ((getClientIp() == null) ? 0 : getClientIp().hashCode());
        result = prime * result + ((getRequestTime() == null) ? 0 : getRequestTime().hashCode());
        result = prime * result + ((getResponseTime() == null) ? 0 : getResponseTime().hashCode());
        result = prime * result + ((getRequestSize() == null) ? 0 : getRequestSize().hashCode());
        result = prime * result + ((getResponseSize() == null) ? 0 : getResponseSize().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getCreatedBy() == null) ? 0 : getCreatedBy().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        result = prime * result + ((getUpdatedBy() == null) ? 0 : getUpdatedBy().hashCode());
        result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", interfaceId=").append(interfaceId);
        sb.append(", requestId=").append(requestId);
        sb.append(", userAgent=").append(userAgent);
        sb.append(", clientIp=").append(clientIp);
        sb.append(", requestTime=").append(requestTime);
        sb.append(", responseTime=").append(responseTime);
        sb.append(", requestSize=").append(requestSize);
        sb.append(", responseSize=").append(responseSize);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", createdBy=").append(createdBy);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", updatedBy=").append(updatedBy);
        sb.append(", isDeleted=").append(isDeleted);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}